using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.ApplicationBlocks.Data;
using System.Data.SqlClient;
using System.Configuration;

namespace DataHelper.DAL
{
    public class webpages_Roles
    {
private static  string m_trConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;

       #region webpages_RolesSelectAll
        public static SqlDataReader webpages_RolesSelectAll(string strSearch="",int top = 1, int bottom = 20, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
                return SqlHelper.ExecuteReader(ConnectionString, "webpages_RolesSelectAllRows",strSearch,top,bottom);
            return SqlHelper.ExecuteReader(m_trConnectionString, "webpages_RolesSelectAllRows",strSearch,top,bottom);
        }
        #endregion
       #region webpages_RolesSelectRow
        public static SqlDataReader webpages_RolesSelectRow(int RoleId, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
                return SqlHelper.ExecuteReader(ConnectionString, "webpages_RolesSelectRow", RoleId);
            return SqlHelper.ExecuteReader(m_trConnectionString, "webpages_RolesSelectRow", RoleId);
        }
        #endregion
       #region webpages_RolesInsertRow
        public static void webpages_RolesInsertRow(string RoleName, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
            {
                SqlHelper.ExecuteNonQuery(ConnectionString, "webpages_RolesInsertRow", RoleName);
                return;
            }
            SqlHelper.ExecuteNonQuery(m_trConnectionString, "webpages_RolesInsertRow", RoleName);
        }
        #endregion
       #region webpages_RolesUpdateRow
        public static void webpages_RolesUpdateRow(int RoleId, string RoleName, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
            {
                SqlHelper.ExecuteNonQuery(ConnectionString, "webpages_RolesUpdateRow", RoleId, RoleName);
                return;
            }
            SqlHelper.ExecuteNonQuery(m_trConnectionString, "webpages_RolesUpdateRow", RoleId, RoleName);
        }
        #endregion
       #region webpages_RolesDeleteRow
        public static void webpages_RolesDeleteRow(int RoleId, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
            {
                SqlHelper.ExecuteNonQuery(ConnectionString, "webpages_RolesDeleteRow", RoleId);
                return;
            }
            SqlHelper.ExecuteNonQuery(m_trConnectionString, "webpages_RolesDeleteRow", RoleId);
        }
        #endregion

    }
}

